package cn.codehaus.core.system.action;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import cn.codehaus.core.common.action.BaseAction;
import cn.codehaus.core.common.server.ApplicationContextUtil;
import cn.codehaus.core.system.dao.user.SysUsers;
import cn.codehaus.core.system.server.UserManage;

public class LoginAction extends BaseAction 
{
	private static Log log = LogFactory.getLog(LoginAction.class);
	
	private HttpServletRequest request = super.getRequest();
	
	private UserManage userManage = (UserManage) ApplicationContextUtil.getBean("UserManage");
	
	private String accounts;
	private String password;
	
	public String getAccounts() {
		return accounts;
	}
	public void setAccounts(String accounts) {
		this.accounts = accounts;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}

	public String login() throws Exception
	{
		System.out.println(accounts + "----" + password);
		SysUsers users = new SysUsers();
		users.setAccounts(accounts);
		users.setPassword(password);
		boolean flag = false;
		try
		{
			flag = userManage.checkingLoginUser(users);
		}
		catch (Exception e) 
		{
			log.error(e);
		}
		System.out.println(flag);
		return "error";
	}
}
